package com.code.factory;

import java.io.File;
import java.io.IOException;

import freemarker.template.Configuration;
import freemarker.template.Version;


public class SQLScriptMain {
    /**
     * FreeMarker配置对象
     */
    private Configuration configuration = new Configuration(new Version("2.3.22"));
    /**
     * 初始化参数
     */
    private void init() {
        // 初始化FreeMarker模板路径
        String path = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        try {
            configuration.setDirectoryForTemplateLoading(new File(path + "config/template"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        configuration.setDefaultEncoding("UTF-8");
    }
    
    public void gen() {
        init();
    }
    
    public static void main(String[] args) {
        SQLScriptMain main = new SQLScriptMain();
        main.gen();
    }
}
